package org.lc.stk.model.question.attrs;

import org.hibernate.annotations.Comment;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.Table;

/**
 * 题型基类
 * 作为系统预置题型和用户自定义题型的基类
 */
@Entity
@Table(name = "question_type")
@Inheritance(strategy = InheritanceType.JOINED)
@Comment("题型基类")
public  class QuestionType {
    public enum Type {
        SYSTEM(1, "系统内置"),
        USER_DEFINED(2, "用户自定义");

        private final int value;
        private final String description;

        Type(int value, String description) {
            this.value = value;
            this.description = description;
        }

        public int getValue() {
            return value;
        }

        public String getDescription() {
            return description;
        }
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(length = 50, nullable = false)
    @Comment("名称")
    private String name;

    @Enumerated(EnumType.STRING)
    @Column(nullable = false)
    @Comment("类型：系统内置或用户自定义")
    private Type type;

    public QuestionType() {

    }

    public Long getId() {
        return id;
    }

    protected void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Type getType() {
        return type;
    }

    protected void setType(Type type) {
        this.type = type;
    }
}
